<!--
@license
Copyright (C) 2015 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<dom-module id="gr-change-list-styles">
  <template>
    <style>
      :host {
        font-size: var(--font-size-normal);
      }
      gr-change-list-item,
      tr {
        border-top: 1px solid var(--border-color);
      }
      gr-change-list-item[selected],
      gr-change-list-item:focus {
        background-color: var(--selection-background-color);
      }
      /* The border-collapse attribute only works on sibling elements, not
        cousin elements. So, if we want the table to have a sticky header and
        have borders between each row, we must disable the border-top on the
        elements directly below a .topHeader. */
      .topHeader ~ gr-change-list-item:first-of-type,
      .topHeader + .groupHeader {
        border-top: none;
      }
      /* Needed to show a border on top of the first gr-change-list-item when a
        groupHeader exists. Cannot use + selector because of dom-repeats
        existing in the DOM tree. */
      .topHeader ~ .groupHeader ~ gr-change-list-item {
        border-top: 1px solid var(--border-color);
      }
      tbody {
        border-bottom: 1px solid var(--border-color);
      }
      tr.topHeader {
        border: none;
      }
      th {
        text-align: left;
      }
      th,
      .cell {
        vertical-align: middle;
      }
      th:not(.label),
      .cell:not(.label) {
        padding-right: 8px;
      }
      th.label {
        border-left: none;
      }
      .topHeader,
      .groupHeader {
        font-weight: var(--font-weight-bold);
      }
      .topHeader th {
        background-color: var(--table-header-background-color);
        height: 3rem;
        position: -webkit-sticky;
        position: sticky;
        top: -1px; /* Offset for top borders */
        z-index: 1;
      }
      /* :after pseudoelements are used here because borders on sticky table
        headers with a background color are broken. */
      th:after {
        border-bottom: 1px solid var(--border-color);
        bottom: 0;
        content: '';
        left: 0;
        position: absolute;
        width: 100%;
      }
      th.label:after {
        border-left: 1px solid var(--border-color);
        top: 0;
      }
      .groupHeader {
        background-color: var(--table-subheader-background-color);
      }
      .groupHeader a {
        color: var(--primary-text-color);
        text-decoration: none;
      }
      .groupHeader a:hover {
        text-decoration: underline;
      }
      .cell {
        height: 2.25rem;
      }
      .star {
        padding: 0;
      }
      gr-change-star {
        vertical-align: middle;
      }
      .branch,
      .star,
      .label,
      .number,
      .owner,
      .assignee,
      .updated,
      .size,
      .status,
      .repo {
        white-space: nowrap;
      }
      .star {
        vertical-align: middle;
      }
      .leftPadding {
        width: var(--default-horizontal-margin);
      }
      .star {
        width: 30px;
      }
      .label {
        border-left: 1px solid var(--border-color);
        text-align: center;
        width: 3rem;
      }
      .topHeader .label {
        border: none;
      }
      .truncatedRepo {
        display: none;
      }
      @media only screen and (max-width: 150em) {
        .assignee,
        .branch,
        .owner {
          overflow: hidden;
          max-width: 18rem;
          text-overflow: ellipsis;
        }
        .truncatedRepo {
          display: inline-block;
        }
        .fullRepo {
          display: none;
        }
      }
      @media only screen and (max-width: 100em) {
        .assignee,
        .branch,
        .owner {
          max-width: 10rem;
        }
      }
      @media only screen and (max-width: 50em) {
        :host {
          font-size: var(--font-size-large);
        }
        gr-change-list-item {
          flex-wrap: wrap;
          justify-content: space-between;
          padding: .25em .5em;
        }
        gr-change-list-item[selected],
        gr-change-list-item:focus {
          background-color: var(--view-background-color);
          border: none;
          border-top: 1px solid var(--border-color);
        }
        gr-change-list-item:hover {
          background-color: var(--view-background-color);
        }
        .cell {
          align-items: center;
          display: flex;
        }
        .topHeader,
        .leftPadding,
        .status,
        .repo,
        .branch,
        .updated,
        .label,
        .assignee,
        .groupHeader .star,
        .noChanges .star {
          display: none;
        }
        .groupHeader .cell,
        .noChanges .cell {
          padding: 0 .5em;
        }
        .subject {
          margin-bottom: .25em;
          width: calc(100% - 2em);
        }
        .owner,
        .size {
          max-width: none;
        }
        .noChanges .cell {
          display: block;
          height: auto;
        }
      }
      @media only screen and (min-width: 1450px) {
        :host {
          font-size: 14px;
        }
      }
    </style>
  </template>
</dom-module>
